package com.netease.xone.itemview;

import android.content.Context;
import android.database.Cursor;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AlphabetIndexer;
import db.manager.ManagerDiscussTip;


public class ItemViewTipTopic extends ItemViewTipBase {

    public ItemViewTipTopic(Context context, int type) {
        super(context, type);
    }

    public ItemViewTipTopic(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ItemViewTipTopic(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void bindView(Cursor cursor) {
        mLeft.setVisibility(View.GONE);
        String value = cursor.getString(ManagerDiscussTip.CONTENT);
        mTitle.setText(value);
    }
    
    
    @Override
    public void bindView(Cursor cursor, AlphabetIndexer alpha) {
        if (null == alpha) {
            return;
        }

        int position = cursor.getPosition();
        int section = alpha.getSectionForPosition(position);
        
        if (alpha.getPositionForSection(section) == position) {
            String title = alpha.getSections()[section].toString().trim();
            mLetter.setText(title);
            mLetter.setVisibility(View.VISIBLE);
        } else {
            mLetter.setVisibility(View.GONE);
        }
    }
}
